<template>
  <div id="center">
    <div class="up">
      <div
        class="bg-color-black item"
        v-for="item in titleItem"
        :key="item.title">
        <p>{{ item.title }}</p>
        <div>
          <dv-digital-flop
            class="dv-dig-flop ml-1 mt-2 pl-3"
            :config="item.number"
          />
        </div>
      </div>
    </div>
    <div class="down">
      <div class="ranking bg-color-black">
        <span>
          <icon name="chart-pie" class="text-icon"></icon>
        </span>
        <span class="fs-xl text mx-2 mb-1 pl-3"></span>
        <dv-scroll-ranking-board class="dv-scr-rank-board mt-1" :config="ranking" />
      </div>
      <!-- <div class="percent">
        <div class="item bg-color-black">
          <span>CPU占有率</span>
          <CenterChart
            :id="rate[0].id"
            :tips="rate[0].tips"
            :colorObj="rate[0].colorData"
          />
        </div>
        <div class="item bg-color-black">
          <span>内存占有率</span>
          <CenterChart
            :id="rate[1].id"
            :tips="rate[1].tips"
            :colorObj="rate[1].colorData"
          />
        </div>
        <div class="water">
          <dv-water-level-pond class="dv-wa-le-po" :config="water" />
        </div> 
      </div>-->
    </div>
  </div>
</template>

<script>
import CenterChart from '@/components/dashboard_components/center/centerChartRate'

export default {
  data() {
    return {
      titleItem: [
        {
          title: '今年累计扫描拓扑次数',
          number: {
            number: [120],
            toFixed: 1,
            textAlign: 'left',
            content: '{nt}',
            style: {
              fontSize: 20
            }
          }
        },
        {
          title: '本月累计扫描拓扑次数',
          number: {
            number: [18],
            toFixed: 1,
            textAlign: 'left',
            content: '{nt}',
            style: {
              fontSize: 20
            }
          }
        },
        {
          title: '今日累计扫描拓扑次数',
          number: {
            number: [2],
            toFixed: 1,
            textAlign: 'left',
            content: '{nt}',
            style: {
              fontSize: 20
            }
          }
        },
        {
          title: '今年失败扫描拓扑次数',
          number: {
            number: [14],
            toFixed: 1,
            textAlign: 'left',
            content: '{nt}',
            style: {
              fontSize: 20
            }
          }
        },
        {
          title: '今年成功扫描拓扑次数',
          number: {
            number: [106],
            toFixed: 1,
            textAlign: 'left',
            content: '{nt}',
            style: {
              fontSize: 20
            }
          }
        },
        {
          title: '今年达标扫描拓扑个数',
          number: {
            number: [100],
            toFixed: 1,
            textAlign: 'left',
            content: '{nt}',
            style: {
              fontSize: 20
            }
          }
        }
      ],
      ranking: {
        data: [
          {
            name: 'Apache Tomcat示例文件',
            value: 2
          },
          {
            name: 'GitLab信息泄露',
            value: 1
          },
          {
            name: 'Gitlab开放用户注册',
            value: 2
          },
          {
            name: 'Laravel调试模式已启用',
            value: 1
          },
          {
            name: 'GitLab用户枚举',
            value: 2
          },
          {
            name: 'X-Frame-Options Header未配置',
            value: 3
          },
          {
            name: 'Host 头攻击',
            value: 2
          },
          {
            name: 'Robots.txt站点文件',
            value: 1
          },
          {
            name: 'GitLab 信息泄露漏洞 (CVE-2022-0735)',
            value: 1
          },
          {
            name: 'Gitlab 代码片段信息泄露',
            value: 1
          },
          {
            name: '隐藏目录',
            value: 1
          },
          {
            name: '开启options方法',
            value: 1
          },
          {
            name: '错误页面Web应用服务器版本泄露',
            value: 1
          },
          {
            name: 'Snoop Servlet 信息泄露',
            value: 1
          },
          {
            name: '敏感目录',
            value: 1
          },
          {
            name: 'PHP 版本泄露',
            value: 2
          },
          {
            name: '子资源完整性 (SRI)未实施',
            value: 1
          },
          {
            name: '默认Tomcat管理后台',
            value: 1
          },
          {
            name: '网站管理后台',
            value: 1
          },
          {
            name: '内网IP',
            value: 1
          },
          {
            name: 'GitLab 用户枚举 （二）',
            value: 1
          },
        ],
        carousel: 'single',
        unit: '个'
      },
      water: {
        data: [24, 45],
        shape: 'roundRect',
        formatter: '{value}%',
        waveNum: 3
      },
      // 通过率和达标率的组件复用数据
      rate: [
        {
          id: 'centerRate1',
          tips: 60,
          colorData: {
            textStyle: '#3fc0fb',
            series: {
              color: ['#00bcd44a', 'transparent'],
              dataColor: {
                normal: '#03a9f4',
                shadowColor: '#97e2f5'
              }
            }
          }
        },
        {
          id: 'centerRate2',
          tips: 40,
          colorData: {
            textStyle: '#67e0e3',
            series: {
              color: ['#faf3a378', 'transparent'],
              dataColor: {
                normal: '#ff9800',
                shadowColor: '#fcebad'
              }
            }
          }
        }
      ]
    }
  },
  components: {
    CenterChart
  }
}
</script>

<style lang="scss" scoped>
#center {
  display: flex;
  flex-direction: column;
  .up {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    .item {
      border-radius: 6px;
      // padding-top: 8px;
      // margin-top: 4px;
      width: 32%;
      height: 75px;
      .dv-dig-flop {
        width: 150px;
        height: 18px;
      }
    }
  }
  .down {
    padding: 6px 4px;
    padding-bottom: 0;
    width: 100%;
    display: flex;
    height: 255px;
    justify-content: space-between;
    .bg-color-black {
      border-radius: 5px;
    }
    .ranking {
      padding: 10px;
      width: 100%;
      .dv-scr-rank-board {
        height: 225px;
      }
    }
    .percent {
      width: 40%;
      display: flex;
      flex-wrap: wrap;
      .item {
        width: 50%;
        height: 120px;
        span {
          margin-top: 8px;
          font-size: 14px;
          display: flex;
          justify-content: center;
        }
      }
      .water {
        width: 100%;
        .dv-wa-le-po {
          height: 120px;
        }
      }
    }
  }
}
</style>
